(function() {
  var e = document.getElementsByTagName("script"), e = e[e.length - 1].src, d = e.substr(0, e.lastIndexOf("/") + 1);
  if("undefined" == typeof jQuery || 1.6 > parseFloat(/^\d\.\d+/i.exec(jQuery.fn.jquery))) {
    var a = 0, s = d + "jquery.js", e = ("https:" == document.location.protocol ? "https" : "http") + "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", t = document.getElementsByTagName("head")[0], h = document.createElement("script");
    h.setAttribute("type", "text/javascript");
    h.setAttribute("src", e);
    t.appendChild(h);
    var l = function() {
      if("undefined" == typeof jQuery || 1.6 > parseFloat(/^\d\.\d+/i.exec(jQuery.fn.jquery))) {
        if(5E3 <= a) {
          a = 0;
          var e = document.createElement("script");
          e.setAttribute("type", "text/javascript");
          e.setAttribute("src", s);
          h.parentNode.replaceChild(e, h)
        }
        a += 100;
        setTimeout(l, 100)
      }else {
        loadHtml5LightBox(d)
      }
    };
    l()
  }else {
    loadHtml5LightBox(d)
  }
})();
function loadHtml5LightBox(e) {
  var d = jQuery;
  d.fn.html5lightbox = function(a) {
    function s() {
      a.nextElem = -1;
      a.prevElem = -1;
      var b, c = a.elemArray[a.curElem][3];
      if(void 0 != c && null != c) {
        for(b = a.curElem + 1;b < a.elemArray.length;b++) {
          if(a.elemArray[b][3] == c) {
            a.nextElem = b;
            break
          }
        }
        if(0 > a.nextElem) {
          for(b = 0;b < a.curElem;b++) {
            if(a.elemArray[b][3] == c) {
              a.nextElem = b;
              break
            }
          }
        }
        if(0 <= a.nextElem) {
          for(b = a.curElem - 1;0 <= b;b--) {
            if(a.elemArray[b][3] == c) {
              a.prevElem = b;
              break
            }
          }
          if(0 > a.prevElem) {
            for(b = a.elemArray.length - 1;b > a.curElem;b--) {
              if(a.elemArray[b][3] == c) {
                a.prevElem = b;
                break
              }
            }
          }
        }
      }
    }
    function t() {
      b.$elem.unbind("mouseenter").unbind("mouseleave").unbind("mousemove");
      b.$next.hide();
      b.$prev.hide();
      b.$loading.show();
      switch(a.elemArray[a.curElem][0]) {
        case 0:
          var i = new Image;
          d(i).load(function() {
            var c = i.width, d = i.height, e;
            a.elemArray[a.curElem][4] ? e = a.elemArray[a.curElem][4] : (e = c, a.elemArray[a.curElem][4] = c);
            a.elemArray[a.curElem][5] ? c = a.elemArray[a.curElem][5] : (c = d, a.elemArray[a.curElem][5] = d);
            var f = r({w:e, h:c});
            n(f.w, f.h, !0, function() {
              b.$text.css({width:h(f.w)});
              b.$text.html(a.elemArray[a.curElem][2]);
              b.$image.show().css({width:f.w, height:f.h});
              b.$image.html("<img src='" + a.elemArray[a.curElem][1] + "' width='" + f.w + "' height='" + f.h + "' />");
              b.$elem.fadeIn(a.fadespeed, function() {
                p()
              })
            })
          });
          d(i).error(function() {
            b.$loading.hide();
            n(a.errorwidth, a.errorheight, !0, function() {
              b.$error.show();
              b.$elem.fadeIn(a.fadespeed, function() {
                p()
              })
            })
          });
          i.src = a.elemArray[a.curElem][1];
          break;
        case 1:
          var c = a.elemArray[a.curElem][4] ? a.elemArray[a.curElem][4] : 480, e = a.elemArray[a.curElem][5] ? a.elemArray[a.curElem][5] : 270, m = r({w:c, h:e}), c = m.w, e = m.h;
          n(c, e, !0, function() {
            b.$text.css({width:h(c)});
            b.$text.html(a.elemArray[a.curElem][2]);
            b.$image.html("<div id='html5lightbox-swf' style='display:block;width:" + c + "px;height:" + e + "px;'></div>").show();
            w(d("#html5lightbox-swf"), c, e, a.elemArray[a.curElem][1], "window", {width:c, height:e});
            b.$elem.show();
            p()
          });
          break;
        case 2:
          var j = a.elemArray[a.curElem][4] ? a.elemArray[a.curElem][4] : 480, k = a.elemArray[a.curElem][5] ? a.elemArray[a.curElem][5] : 270, m = r({w:j, h:k}), j = m.w, k = m.h;
          n(j, k, !0, function() {
            b.$text.css({width:h(j)});
            b.$text.html(a.elemArray[a.curElem][2]);
            b.$image.html("<div id='html5lightbox-video' style='display:block;width:" + j + "px;height:" + k + "px;'></div>").show();
            var c = a.isMobile;
            if(!a.isMobile && !a.flashInstalled && a.html5VideoSupported && (a.isIE9 || a.isSafari || a.isChrome || a.Opera)) {
              c = !0
            }
            if(c) {
              var c = d("#html5lightbox-video"), i = j, f = k;
              c.html("<div style='position:absolute;display:block;width:" + i + "px;height:" + f + "px;'><video width=" + i + " height=" + f + " controls='controls' src='" + a.elemArray[a.curElem][1] + "'></div>");
              a.isAndroid && d("<div style='position:absolute;display:block;cursor:pointer;width:" + i + "px;height:" + f + 'px;background:url("' + a.skinfolder + "playvideo_64.png\") no-repeat center center;'></div>").appendTo(c).unbind("click").click(function() {
                d("video", d(this).parent())[0].play()
              })
            }else {
              c = a.elemArray[a.curElem][1], "/" != c.charAt(0) && ("http:" != c.substring(0, 5) && "https:" != c.substring(0, 6)) && (c = a.htmlfolder + c), w(d("#html5lightbox-video"), j, k, a.jsfolder + "html5boxplayer.swf", "transparent", {width:j, height:k, videofile:c, autoplay:"0", errorcss:".html5box-error" + a.errorcss, id:0})
            }
            b.$elem.show();
            p()
          });
          break;
        case 3:
        ;
        case 4:
          var f = a.elemArray[a.curElem][4] ? a.elemArray[a.curElem][4] : 480, g = a.elemArray[a.curElem][5] ? a.elemArray[a.curElem][5] : 270, m = r({w:f, h:g}), f = m.w, g = m.h;
          n(f, g, !0, function() {
            b.$text.css({width:h(f)});
            b.$text.html(a.elemArray[a.curElem][2]);
            b.$image.html("<div id='html5lightbox-video' style='display:block;width:" + f + "px;height:" + g + "px;'></div>").show();
            var c = a.elemArray[a.curElem][1];
            3 == a.elemArray[a.curElem][0] && (c = 0 > c.indexOf("?") ? c + "?wmode=transparent" : c + "&wmode=transparent");
            d("#html5lightbox-video").html("<iframe width='" + f + "' height='" + g + "' src='" + c + "' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>");
            b.$elem.show();
            p()
          });
          break;
        case 7:
          var q = a.elemArray[a.curElem][4] ? a.elemArray[a.curElem][4] : d(window).width(), l = a.elemArray[a.curElem][5] ? a.elemArray[a.curElem][5] : d(window).height(), m = r({w:q, h:l}), q = m.w, l = m.h;
          n(q, l, !0, function() {
            b.$text.css({width:h(q)});
            b.$text.html(a.elemArray[a.curElem][2]);
            b.$image.html("<div id='html5lightbox-web' style='display:block;width:" + q + "px;height:" + l + "px;'></div>").show();
            d("#html5lightbox-web").html("<iframe width='" + q + "' height='" + l + "' src='" + a.elemArray[a.curElem][1] + "' frameborder='0'></iframe>");
            b.$elem.show();
            p()
          })
      }
    }
    function h(b) {
      b -= 36;
      if(0 < a.prevElem || 0 < a.nextElem) {
        b -= 36
      }
      return b
    }
    function l() {
      var i = Math.round(d(window).height() / 2 - (b.$lightboxBox.height() + a.barheight) / 2);
      b.$lightboxBox.animate({"margin-top":i}, a.resizespeed)
    }
    function r(b) {
      var c = d(window).height() - a.barheight - 2 * a.bordersize;
      b.h > c && (b.w = Math.round(b.w * c / b.h), b.h = c);
      c = d(window).width() - 2 * a.bordersize;
      b.w > c && (b.h = Math.round(b.h * c / b.w), b.w = c);
      return b
    }
    function p() {
      b.$elemData.show();
      b.$lightboxBox.animate({height:b.$lightboxBox.height() + a.barheight}, {queue:!0, duration:a.resizespeed})
    }
    function n(i, c, e, g) {
      var j = e ? a.resizespeed : 0, k = i + 2 * a.bordersize, f = c + 2 * a.bordersize, i = Math.round(d(window).height() / 2 - (f + a.barheight) / 2);
      k == b.$elemWrap.width() && f == b.$elemWrap.height() && (j = 0);
      b.$loading.hide();
      b.$watermark.hide();
      b.$lightboxBox.animate({"margin-top":i}, j, function() {
        b.$lightboxBox.css({width:k, height:f});
        b.$elemWrap.animate({width:k}, j).animate({height:f}, j, function() {
          b.$loading.show();
          b.$watermark.show();
          b.$elem.bind("mouseenter mousemove", function() {
            if(0 <= a.prevElem || 0 <= a.nextElem) {
              b.$next.fadeIn(), b.$prev.fadeIn()
            }
          });
          b.$elem.bind("mouseleave", function() {
            b.$next.fadeOut();
            b.$prev.fadeOut()
          });
          g()
        })
      })
    }
    function v() {
      a.stamp && b.$watermark.hide();
      b.$image.empty();
      b.$text.empty();
      b.$error.hide();
      b.$loading.hide();
      b.$image.hide();
      b.$elemData.hide()
    }
    function x() {
      v();
      b.$lightbox.hide();
      d("select, embed, object").css({visibility:"visible"})
    }
    function y(b) {
      if(-1 == b) {
        if(0 > a.nextElem) {
          return
        }
        a.curElem = a.nextElem
      }else {
        if(-2 == b) {
          if(0 > a.prevElem) {
            return
          }
          a.curElem = a.prevElem
        }
      }
      s();
      v();
      t()
    }
    function w(b, c, e, g, j, k) {
      if(a.flashInstalled) {
        var f = {pluginspage:"http://www.adobe.com/go/getflashplayer", quality:"high", allowFullScreen:"true", allowScriptAccess:"always", type:"application/x-shockwave-flash"};
        f.width = c;
        f.height = e;
        f.src = g;
        f.flashVars = d.param(k);
        f.wmode = j;
        var c = "", h;
        for(h in f) {
          c += h + "=" + f[h] + " "
        }
        b.html("<embed " + c + "/>")
      }else {
        b.html("<div class='html5lightbox-flash-error' style='display:block; position:relative;text-align:center; width:" + c + "px; left:0px; top:" + Math.round(e / 2 - 10) + "px;'><div class='html5-error'><div>The required Adobe Flash Player plugin is not installed</div><br /><div style='display:block;position:relative;text-align:center;width:112px;height:33px;margin:0px auto;'><a href='http://www.adobe.com/go/getflashplayer'><img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' width='112' height='33'></img></a></div></div>")
      }
    }
    a = jQuery.extend({overlaybgcolor:"#000000", overlayopacity:0.9, bgcolor:"#ffffff", bordersize:8, barheight:36, loadingwidth:64, loadingheight:64, resizespeed:400, fadespeed:400, skinfolder:"skins/default/", titlecss:"{color:#333333; font-size:16px; font-family:Armata,sans-serif,Arial; overflow:hidden; white-space:nowrap;}", errorwidth:280, errorheight:48, errorcss:"{text-align:center; color:#ff0000; font-size:14px; font-family:Arial, sans-serif;}", version:"1.4", stamp:!1, freemark:"html5box.com", 
    freelink:"http://html5box.com/", watermark:"", watermarklink:""}, a);
    "undefined" != typeof html5lightbox_options && html5lightbox_options && jQuery.extend(a, html5lightbox_options);
    a.htmlfolder = window.location.href.substr(0, window.location.href.lastIndexOf("/") + 1);
    a.jsfolder = e;
    "/" != a.skinfolder.charAt(0) && ("http:" != a.skinfolder.substring(0, 5) && "https:" != a.skinfolder.substring(0, 6)) && (a.skinfolder = e + a.skinfolder);
    a.htmlfolder = encodeURI(a.htmlfolder);
    a.jsfolder = encodeURI(a.jsfolder);
    a.skinfolder = encodeURI(a.skinfolder);
    a.types = "IMAGE FLASH VIDEO YOUTUBE VIMEO PDF MP3 WEB".split(" ");
    a.elemArray = [];
    a.curElem = -1;
    a.flashInstalled = !1;
    try {
      new ActiveXObject("ShockwaveFlash.ShockwaveFlash") && (a.flashInstalled = !0)
    }catch(z) {
      navigator.mimeTypes["application/x-shockwave-flash"] && (a.flashInstalled = !0)
    }
    a.html5VideoSupported = !!document.createElement("video").canPlayType;
    a.isChrome = null != navigator.userAgent.match(/Chrome/i);
    a.isFirefox = null != navigator.userAgent.match(/Firefox/i);
    a.isOpera = null != navigator.userAgent.match(/Opera/i);
    a.isSafari = null != navigator.userAgent.match(/Safari/i);
    a.isIE9 = d.browser.msie && a.html5VideoSupported;
    a.isIE678 = d.browser.msie && !a.isIE9;
    a.isAndroid = null != navigator.userAgent.match(/Android/i);
    a.isIPad = null != navigator.userAgent.match(/iPad/i);
    a.isIPhone = null != navigator.userAgent.match(/iPod/i) || null != navigator.userAgent.match(/iPhone/i);
    a.isMobile = a.isAndroid || a.isIPad || a.isIPhone;
    a.resizeTimeout = -1;
    var b = this;
    b.each(function() {
      if("a" == this.nodeName.toLowerCase()) {
        var b = d(this), c;
        c = b.attr("href");
        c = !c ? -1 : c.match(/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i) ? 0 : c.match(/[^\.]\.(swf)\s*$/i) ? 1 : c.match(/\.(flv|mp4|m4v|ogv|ogg|webm)(.*)?$/i) ? 2 : c.match(/\:\/\/.*(youtube\.com)/i) || c.match(/\:\/\/.*(youtu\.be)/i) ? 3 : c.match(/\:\/\/.*(vimeo\.com)/i) ? 4 : c.match(/[^\.]\.(pdf)\s*$/i) ? 5 : c.match(/[^\.]\.(mp3)\s*$/i) ? 6 : 7;
        0 > c || a.elemArray.push([c, b.attr("href"), b.attr("title"), b.data("group"), b.data("width"), b.data("height")])
      }
    });
    var g = ("https:" == document.location.protocol ? "https" : "http") + "://fonts.googleapis.com/css?family=Armata", u = document.createElement("link");
    u.setAttribute("rel", "stylesheet");
    u.setAttribute("type", "text/css");
    u.setAttribute("href", g);
    document.getElementsByTagName("head")[0].appendChild(u);
    g = "#html5-text " + a.titlecss;
    g += ".html5-error " + a.errorcss;
    d("head").append("<style type='text/css'>" + g + "</style>");
    b.$lightbox = jQuery("<div id='html5-lightbox' style='display:none;position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:999;'><div id='html5-lightbox-overlay' style='display:block;position:absolute;top:0px;left:0px;width:100%;height:100%;background-color:" + a.overlaybgcolor + ";opacity:" + a.overlayopacity + ";filter:alpha(opacity=" + Math.round(100 * a.overlayopacity) + ");'></div><div id='html5-lightbox-box' style='display:block;position:relative;margin:0px auto;overflow:hidden;'><div id='html5-elem-box' style='display:block;position:relative;margin:0px auto;text-align:center;'><div id='html5-elem-wrap' style='display:block;position:relative;margin:0px auto;text-align:center;background-color:" + 
    a.bgcolor + ";'><div id='html5-loading' style='display:none;position:absolute;text-align:center;width:100%;height:100%;background:url(\"" + a.skinfolder + "loading.gif\") no-repeat center center;'></div><div id='html5-error' class='html5-error' style='display:none;position:absolute;padding:" + a.bordersize + "px;text-align:center;width:" + a.errorwidth + "px;height:" + a.errorheight + "px;'>The requested content cannot be loaded.<br />Please try again later.</div><div id='html5-image' style='display:none;position:absolute;padding:" + 
    a.bordersize + "px;text-align:center;'></div></div><div id='html5-next' style='display:none;cursor:pointer;position:absolute;right:" + a.bordersize + "px;top:40%;'><img src='" + a.skinfolder + "next.png'></div><div id='html5-prev' style='display:none;cursor:pointer;position:absolute;left:" + a.bordersize + "px;top:40%;'><img src='" + a.skinfolder + "prev.png'></div></div><div id='html5-elem-data-box' style='display:none;position:relative;width:100%;margin:0px auto;height:" + a.barheight + "px;background-color:" + 
    a.bgcolor + ";'><div id='html5-text' style='display:block;float:left;overflow:hidden;margin-left:" + a.bordersize + "px;'></div><div id='html5-close' style='display:block;cursor:pointer;float:right;margin-right:" + a.bordersize + "px;'><img src='" + a.skinfolder + "close.png'></div></div><div id='html5-watermark' style='display:none;position:absolute;left:" + String(a.bordersize + 2) + "px;top:" + String(a.bordersize + 2) + "px;'></div></div></div>");
    b.$lightbox.appendTo("body");
    b.$lightboxBox = d("#html5-lightbox-box", b.$lightbox);
    b.$elem = d("#html5-elem-box", b.$lightbox);
    b.$elemWrap = d("#html5-elem-wrap", b.$lightbox);
    b.$loading = d("#html5-loading", b.$lightbox);
    b.$error = d("#html5-error", b.$lightbox);
    b.$image = d("#html5-image", b.$lightbox);
    b.$elemData = d("#html5-elem-data-box", b.$lightbox);
    b.$text = d("#html5-text", b.$lightbox);
    b.$next = d("#html5-next", b.$lightbox);
    b.$prev = d("#html5-prev", b.$lightbox);
    b.$close = d("#html5-close", b.$lightbox);
    b.$watermark = d("#html5-watermark", b.$lightbox);
    a.stamp ? b.$watermark.html("<a href='" + a.freelink + "' style='text-decoration:none;'><div style='display:block;width:120px;height:20px;text-align:center;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;filter:alpha(opacity=60);opacity:0.6;background-color:#333333;color:#ffffff;font:12px Armata,sans-serif,Arial;'><div style='line-height:20px;'>" + a.freemark + "</div></div></a>") : a.watermark && (g = "<img src='" + a.watermark + "' style='border:none;' />", a.watermarklink && 
    (g = "<a href='" + a.watermarklink + "' target='_blank'>" + g + "</a>"), b.$watermark.html(g));
    d("#html5-lightbox-overlay", b.$lightbox).click(x);
    b.$close.click(x);
    b.$next.click(function() {
      y(-1)
    });
    b.$prev.click(function() {
      y(-2)
    });
    d(window).resize(function() {
      a.isMobile || (clearTimeout(a.resizeTimeout), a.resizeTimeout = setTimeout(function() {
        l()
      }, 500))
    });
    d(window).scroll(function() {
      b.$lightbox.css("top", d(window).scrollTop())
    });
    d(window).bind("orientationchange", function() {
      a.isMobile && l()
    });
    return b.unbind("click").click(function() {
      if(0 >= a.elemArray.length) {
        return!0
      }
      var e = d(this);
      d("select, embed, object").css({visibility:"hidden"});
      for(var c = 0;c < a.elemArray.length && a.elemArray[c][1] != e.attr("href");c++) {
      }
      if(c == a.elemArray.length) {
        return!0
      }
      a.curElem = c;
      a.nextElem = -1;
      a.prevElem = -1;
      s();
      b.$next.hide();
      b.$prev.hide();
      v();
      b.$lightbox.show();
      b.$lightbox.css("top", d(window).scrollTop());
      var e = a.loadingwidth + 2 * a.bordersize, c = a.loadingheight + 2 * a.bordersize, g = Math.round(d(window).height() / 2 - (c + a.barheight) / 2);
      b.$lightboxBox.css({"margin-top":g, width:e, height:c});
      b.$elemWrap.css({width:e, height:c});
      t();
      return!1
    })
  };
  jQuery(document).ready(function() {
    $(".html5lightbox").html5lightbox()
  })
}
;